package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.PutMapping;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderSettingMapper {
    //根据预约日期修改可预约人数
    @Update("update order_setting set number = #{number},reservations = #{reservations} where order_date = #{orderDate}")
    public void editReservationsByOrderDate(OrderSetting orderSetting);

    //根据预约日期查询预约设置信息
    @Select("select * from order_setting where order_date = #{orderDate}")
    public OrderSetting findByOrderDate(Date orderDate);

    @Insert("insert into order_setting(order_date,number,reservations) values(#{orderDate},#{number},#{reservations})")
    void add(OrderSetting orderSetting);

    @Select("select * from order_setting where order_date between #{startDate} and #{endDate}")
    List<OrderSetting> getOrderSettingByMonth(Date startDate, Date endDate);
}
